package com.hyjr.RxTask.work;

import com.alibaba.fastjson.JSON;
import com.hyjr.RxTask.common.Constants;
import com.hyjr.RxTask.netty.client.SendCheckResultClient;
import com.hyjr.RxTask.work.service.ConsumerWork;
import com.hyjr.bean.CheckBean;
import com.hyjr.common.utils.LogUtils;

public class CheckResultWork implements ConsumerWork {
	private static CheckResultWork _dctaskScheduler = null;

	public static CheckResultWork GetInstance() {
		if (_dctaskScheduler == null) {
			_dctaskScheduler = new CheckResultWork();
		}
		return _dctaskScheduler;
	}

	@Override
	public void doWork(String message) throws Exception {
		LogUtils.debug("检测端，CheckResultWork线程，获取检测结果：" + message);
		
		CheckBean checkBean = JSON.parseObject(message, CheckBean.class);
		
		//将检测结果返回给请求方
		new SendCheckResultClient().connect(Constants.SEND_CHECK_RESULT_PORT, "127.0.0.1", checkBean);
	}
}
